#include <stdio.h>

int OnlinMax(int List[], int N){
	int TempSum = 0, MaxSum = 0 ;
	int i;
	for(i=0;i<N;i++){
		TempSum += List[i];
		if(MaxSum<0) {
			TempSum = 0;
			MaxSum = 0;
		}
		else if(TempSum > MaxSum) MaxSum = TempSum;

			
	}
	return MaxSum;
}
int main(void){
	int list[] = {4,-3,5,-2,-1,2,6,-2};
	printf("最大子列和=%d",OnlinMax(list,8));

}
